import base64

class Auth:

    def __init__(self, host, user=None, passwd=None, https=False) -> None:
        self.host = host
        self.user = user
        self.passwd = passwd
        self.https = https
        pass

    def getBase64(self) -> str:
        if self.user is None or self.passwd is None:
            return ""
        return "Basic " + base64.b64encode(f"{self.user}:{self.passwd}".encode("utf-8")).decode("utf-8")

    def getHost(self):
        if self.https == True:
            return "https://" + self.host
        return "http://" + self.host
